import App from "../App";
import Login from "../pages/Login";
import NotFound from "../pages/NotFound";
import {RvcRouteConfig} from "central-react-router";

const routes: RvcRouteConfig[] = [
    {path: '/', component: App},
    {path: '/login', component: Login},
    // wrappers 会从右到左开始逐层包装, 只有所有wrapper都执行成功, 最后才会渲染 MyHome 组件
    {
        path: '/MyHome',
        component: 'pages/MyHome',
        wrappers: ['wrappers/AuthWrapper', 'wrappers/LoginValidateWrapper', 'wrappers/OtherWrapper']
    },
    //嵌套路由
    {
        path: '/home', component: 'pages/Home', exact: false,
        routes: [
            {path: "/home", redirect: '/home/01'},
            {path: "/home/01", component: 'pages/Children01'},
            {path: "/home/02", component: 'pages/Children02'},
            {component: NotFound},
        ]
    },
    {component: NotFound},
]

export default routes;
